<?php
/**
 * @version      BOSSCMS-Free
 * @trademark    BOSSCMS
 * @copyright    Copyright © by BOSSCMS-Free (https://www.bosscms.net/) 保留所有权利
 * @license      https://gitee.com/Greenpeas/BOSSCMS/license/ 和 https://www.bosscms.net/freelicense/
 * @link         https://www.bosscms.net/
 * @author       温州软界网络技术有限公司
**/
defined('IS_OK') or exit('Access Forbidden');
?>
<?php load::into('head'); ?>
<form action="<?php echo url::mpf('manager','manager','check_add'); ?>" method="post" enctype="multipart/form-data">
<?php echo form::input('show',1,null,'hidden',array(),false); ?>
<section class="main form tree" tree="checktable" cookie="checkTableTr">
  <?php if($G['manager']['level']==1 || $G['manager']['allow']['read'] || $G['manager']['allow']['audit']){ ?>
  <aside>
    <div>
      <h2><strong>内容管理</strong></h2>
      <?php if($G['manager']['level']==1 || $G['manager']['allow']['read']){ ?>
      <dl>
        <dt>查看权限</dt>
        <dd>
          <?php echo form::checkbox("allow[read]",$data['allow']['read'],null,array('1'=>'允许查看所有发布内容')); ?>
          <cite>注：不选择则该管理员只能查看自己和下级管理员发布的内容</cite>
        </dd>
      </dl>
      <?php } ?>
    </div>
  </aside>
  <?php } ?>
  <aside>
    <div>
      <h2><strong>功能权限</strong></h2>
      <div class="fun">
        <p>
          <a class="button green selectall tfa">
            <em class="fa fa-random"></em>
            <font><u>取消</u>全选</font>
          </a>
          <a class="button black treecheck right" tree="checktable">
            <em class="fa fa-expand"></em>
            <font>收缩菜单</font>
            <em class="fa fa-compress"></em>
            <font>展开菜单</font>
          </a>
        </p>
        <table>
          <tbody>          
            <?php foreach($G['permit'] as $k=>$v){ ?>
            <?php if($G['manager']['level']==1 || (!$v['input'] || $data['pe'][$v['input']])){ ?>
            <tr level="<?php echo $v['level']; ?>" it="<?php echo $k; ?>">
              <td lv><?php echo $v['name']; ?></td>
              <td class="check">
              <?php
              if($v['check']){
                $arr = array('R'=>'查看','A'=>'新增','M'=>'修改','D'=>'删除');
                $param = array();
                $check = str_split($v['check']);
                foreach($check as $c){
                  if($G['manager']['level']==1 || in_array($c,$data['pe'][$v['input']])){
                    $param[$c] = $arr[$c]; 
                  }
                }
                echo form::checkbox("permit[{$v['input']}]",$data['permit'][$v['input']],null,$param);
              }
              ?>
              </td>
            </tr>
            <?php } ?>
            <?php } ?>
          </tbody>
        </table>
      </div>
    </div>
  </aside>
</section>

<section class="refer">
  <button class="button ok" type="submit">
    <em class="fa fa-floppy-o"></em>
    <font>保存</font>
  </button>
</section>
</form>
<?php load::into('foot'); ?>